#!/bin/sh

set -e

package='nato-rto-latex'

if test $# -ne 1; then
  echo "usage: $0 VERSION"
  exit 0
fi

version=$1

if echo $version | egrep -e "[0-9]+\.[0-9]+\.[0-9]+"; then
  echo "Packaging $package-$version"
else
  echo "VERSION should be of form 1.2.5 (major.minor.revision)"
  exit 1
fi

mkdir $package-$version
cp `cat Manifest.txt` $package-$version
tar zcf $package-$version.tgz $package-$1
rm -rf $package-$version

cat << MESSAGE
`md5sum $package-$version.tgz`

Don't forget to upload and tag, e.g.,
 svn cp -m'To tag release $version.' \\
   https://nato-rto-latex.googlecode.com/svn/trunk \\
   https://nato-rto-latex.googlecode.com/svn/tags/rel_$version
MESSAGE
